# Maintainer: Guillaume ALAUX <guillaume@archlinux.org>
_libname=jline
pkgname=("java-${_libname}")
pkgver=1.0
pkgrel=2
pkgdesc="Java library for handling console input"
arch=('any')
url="http://jline.sourceforge.net/"
license=('BSD')
depends=('java-runtime-headless')
makedepends=('maven')
checkdepends=('maven')
source=(http://downloads.sourceforge.net/project/${_libname}/${_libname}/${pkgver}/${_libname}-${pkgver}.zip)
md5sums=('811dc1c8a351a2e928524bd79eb9e798')
_M2_REPO=${srcdir}/.m2

build() {
  cd "${srcdir}/${_libname}-${pkgver}/src"

  mkdir ${_M2_REPO}
  mvn -Dmaven.repo.local=${_M2_REPO} \
    clean \
    package
}

check() {
  cd "${srcdir}/${_libname}-${pkgver}/src"

  mvn -Dmaven.repo.local=${_M2_REPO} \
    test
}

package() {
  cd "${srcdir}/${_libname}-${pkgver}"

  install -Dm644 src/target/${_libname}-${pkgver}.jar \
                 ${pkgdir}/usr/share/java/${_libname}-${pkgver}.jar
  ln -s ${_libname}-${pkgver}.jar ${pkgdir}/usr/share/java/${_libname}.jar

  install -Dm644 LICENSE.txt ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}
